<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8" import="com.neusoft.news.bean.News"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<style type="text/css">
.div_news_zhengwen{
	display: flex;
	width: 70%;
	margin: auto;
}
.img_news{
	display: flex;
	margin: 0 auto;
}
.button_delete{
	background-color: red;
	padding: 10px 20px;
	float: right;
}
.button_return{
	padding: 10px 20px;
	float: left;
}
</style>
<%
	News news = (News)request.getAttribute("news");
%>
<script type="text/javascript">
	function delete_news(){
		if(confirm("是否删除该新闻？")){
			window.location.href="http://localhost:8080/newsweb/DeleteNewsServlet?news_id=<%=news.getNews_id() %>";
		}
	}
	function return_news(){
		window.history.back(-1);
	}
</script>
<title><%=news.getNews_title() %></title>
</head>
<body>
	<button class="button_return" onclick="return_news()">返回</button>
	<button class="button_delete" onclick="delete_news()">删除</button>
	<h1 style="text-align: center;"><%=news.getNews_title() %></h1>
	<p><%=news.getNews_date() %>&emsp;<%=news.getNews_author() %>&emsp;<%=news.getNews_place() %></p>
	<hr>
	<% if(news.getNews_photo()!= null && !news.getNews_photo().equals("") ){ %>
		<img src="${pageContext.request.contextPath}/img/<%=news.getNews_photo() %>" class="img_news">
	<% } %>
	<div class="div_news_zhengwen">
		<p><%=news.getNews_content() %></p>
	</div>
</body>
</html>